package com.kingwood.algorithm.test;

import java.util.Scanner;
import java.util.StringJoiner;

/**
 * @Author 22025812
 * @Description: 字符串分割(二)
 * https://fcqian.blog.csdn.net/article/details/127417881
 * @Date: 2024/3/27 10:07
 * @Modified By：
 * @Version 1.0
 */
public class StrSplit {
    public static String getResult(int k, String str) {
        String[] strArr = str.split("-");
        StringJoiner sj = new StringJoiner("-");
        sj.add(strArr[0]);

        StringBuilder sb = new StringBuilder();
        for (int i = 1; i < strArr.length; i++) {
            sb.append(strArr[i]);
        }

        int len = sb.length();
        for (int i = 0; i < len; i+= k) {
           String subStr = sb.substring(i, Math.min(i + k, len));
           sj.add(convertStr(subStr));
        }

        return sj.toString();
    }

    public static String convertStr(String str) {
        int uppper = 0;
        int lower = 0;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            if (c >= 'A' && c <= 'Z') {
                uppper++;
            }
            if (c >= 'a' && c <= 'z') {
                lower++;
            }
        }

        if (uppper > lower) {
            str = str.toUpperCase();
        }
        if (uppper < lower) {
            str = str.toLowerCase();
        }

        return str;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int k = Integer.parseInt(sc.nextLine());
        String str = sc.nextLine();
        System.out.println(getResult(k, str));
    }
}
